﻿/**
*意向领用
*/
Chenxin.UI.GetLetterForm = Chenxin.extend(Chenxin.UI.FormCommon,{
    actionUrl:'/service/logic/ShowListIntent.ashx',
    id:'GetLetter',
    renderTo:'divGetLetter',
    jqmWidth:400,
    defBBtn:true,
	customerFormVal:function(json){
		if(!json.LastEmployeeGetTime){
			alert('请选择领用日期！');
			return false;
		}
		return true;
	},
    createForm: function() {
        return Chenxin.FormCommon.GetLetterForm(this.id);
    },
    initEvent: function() {
        /*************事件：领用日期得到焦点*************/
        $("#LastEmployeeGetTime").focus(function(){
            WdatePicker({
                dateFmt:'yyyy-MM-dd',
                oncleared:function(){
                            $(this).blur();
                          },
                onpicked:function(){
                            $(this).blur();
                         }
            });
        });
    },
    createComboList:function(){
        //领用部门
        var comboBelongDepartId = new Chenxin.UI.StructCombo({
            param: { op: 'getcontroldeparts' },
            containerId: '#'+this.id+'_BelongDepartId',
			name:'BelongDepartId',
            inModelType: 'all',
            txtModelName: 'BelongDepart',
            required: true,
            tbxWidth: 129,
			disable:true,
			afterInit:function(){
				this.setValue(this.vv);
			},
            // ,onSelected: function() {
                // if( this.getValue() != this.defVal ){
					// comboLastEmployeeId.loadUser(this.getValue());
				// }
            // }
			// ,
            // afterSetValue: function(newVal, oldVal) {
                // if( newVal != "请选择" ){
			       // comboLastEmployeeId.loadUser(newVal);
				// }
            // }
        });
        //领用人员
        var comboLastEmployeeId = new Chenxin.UI.RichModelTreeCombo({
            textBoxId: this.id+'_LastEmployeeId',
            inModelType: 'all',
            txtModelName: 'LastEmployee',
            required: true,
            singleSelect: true,
            name: 'LastEmployeeId'
        });
        return [comboBelongDepartId,comboLastEmployeeId];
    },
    saveSucc: function() {
        this.reloadGrid();
    },
    initComponent: function() {
        Chenxin.UI.GetLetterForm.superclass.initComponent.call(this);
    }
});

Chenxin.FormCommon.GetLetterForm=function(formID){
return '<table class="tbl_f"><tr><th style="width:120px; height:26px;">意向书编号：</th><td><input name="IntentionCode" class="inputbox_n fl" type="text" readonly="readonly" style="width:160px;"/></td></tr><tr><th>领用部门：</th><td><div id="'+formID+'_BelongDepartId"style="z-index:1; margin-right: 2px;" class="SelectWrapSingle"></div></td></tr><tr><th>领用人员：</th><td><input type="text"  class="inputbox_n fl" id="'+formID+'_LastEmployeeId" style="width:160px;"/></td></tr><tr><th>领用日期：</th><td><input type="text" id="LastEmployeeGetTime" name="LastEmployeeGetTime" readonly="readonly" class="inputbox_n fl" style="width:160px" /></td></tr><tr><td colspan="2" ><input type="hidden"  name="IntentionId" /></td></tr></table>';
};